/**
 * @author: xinmi
 * @date: 2020/11/2
 * @description:
 */
import org.apache.commons.beanutils.PropertyUtils;


public class PropertyType {
    public static void main(String[] args) {
        Bean recording = new Bean(1,"sxm","beijing");
        recording.setName("Magical Mystery Tour");

        try {
            /*
             * Using PropertyUtils.getPropertyType() to determine the type of
             * title property.
             */
            Class type = PropertyUtils.getPropertyType(recording, "name");

            System.out.println("type = " + type.getName());

            String value = (String) PropertyUtils.getProperty(recording, "name");
            System.out.println("value = " + value);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
